package com.bishe.demo.modules.hotel.hotelRoom.dao;

import com.bishe.demo.modules.account.entity.User;
import com.bishe.demo.modules.hotel.hotelRoom.entity.Bed;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface BedDao {
    @Insert("insert into hotel_bed values(null,#{bedName},#{bedNum})")
    @Options(useGeneratedKeys = true, keyProperty = "bedId", keyColumn = "bed_id")
    void insertBed(Bed bed);

    @Select("select * from hotel_bed hb left join hotel_room_bed hrb on hrb.bed_id=hb.bed_id where hrb.room_id=#{roomId}")
    List<Bed> getBedsByRoomId(int roomId);

    @Delete("delete from hotel_bed where bed_id=#{bedId} ")
    void deleteBedsByBedId(int bedId);
}
